import type {IOrder, ISearchParams} from '@/types/request';
import request from '@/utils/request';

// 获取订单列表
export function searchOrder(options: Omit<ISearchParams, 'total'>) {
    let params: Omit<ISearchParams, 'total'> = {
        page: options.page,
        size: options.size,
    };
    if (options.gmt_start) params.gmt_start = options.gmt_start;
    if (options.gmt_end) params.gmt_end = options.gmt_end;

    return request<IOrder, true>(
        `/order${options?.condition ? '/' + options.condition : ''}`,
        {params}
    );
}

